<!DOCTYPE HTML>
<html lang="en-US">

<head>
    <meta charset="UTF-8">
    <title>维修公司后台管理</title>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $.ajax({
                type: "POST",
                url: "{:url('portal/mei/san')}",
                data: {},
                dataType:"json",
                success: function(res){
                    var html = '';
                    var data = res['data'];
                    if(data != ''){
                        $.each(data,function(index,value){
                            html += '<option value="'+data[index]['provinceID']+'">'+data[index]['province']+'</option>';
                        });
                        $("#province").append(html);
                    }
                }
            });

            $("#province").change(function(){
                var provinceID = $("#province option:selected").val();
                $.ajax({
                    type: "POST",
                    url: "{:url('portal/mei/san')}",
                    data: {provinceID:provinceID},
                    dataType:"json",
                    success: function(res){
                        console.log(res);
                        var html = '';
                        $("#city").html('');
                        var data = res['data'];
                        if(data != ''){
                            $.each(data,function(index,value){
                                html += '<option value="'+data[index]['cityID']+'">'+data[index]['city']+'</option>';
                            });
                            $("#city").append(html);
                        }
                    }
                });
            });

            $("#city").change(function(){
                var cityID = $("#city option:selected").val();
                console.log(cityID);
                $.ajax({
                    type: "POST",
                    url: "{:url('portal/mei/san')}",
                    data: {cityID:cityID},
                    dataType:"json",
                    success: function(res){
                        console.log(res);
                        var html = '';
                        $("#area").html('');
                        var data = res['data'];
                        if(data != ''){
                            $.each(data,function(index,value){
                                html += '<option value="'+data[index]['areaID']+'">'+data[index]['area']+'</option>';
                            });
                            $("#area").append(html);
                        }
                    }
                });
            });
        });
    </script>
</head>

<body>
<div class="container">
    <div class="row">
        <h1>维修公司后台管理</h1>
    </div>
    <form method="post" action="{:url('mei/infoSave')}" enctype="multipart/form-data" class="js-ajax-form">
        <div class="form-group">
            <label for="name">维修公司名称</label>
            <input type="text" class="form-control" id="name" placeholder="请填写维修公司名称" name="name" value="{$res.name|default=''}">
            <input type="hidden" class="form-control" id="id" name="id" value="{$res.id|default=''}">
            <input type="hidden" class="form-control" id="cate_id" name="cate_id" value="{$cate_id.cate_id|default=''}">
        </div>


        <div class="form-group">
            <label for="serviceItems">服务项目</label>
            <input type="text" class="form-control" id="serviceItems" placeholder="服务项目" name="serviceItems" value="{$res.serviceItems|default=''}">
        </div>
        <div class="form-group">
            <label for="phoner">联系人</label>
            <input type="text" class="form-control" id="phoner" placeholder="联系人" name="phoner" value="{$res.phoner|default=''}">
        </div>

        <div class="form-group">
            <label for="phone">联系电话</label>
            <input type="tel" class="form-control" id="phone" placeholder="请填写维修公司联系电话" name="phone" value="{$res.phone|default=''}">
        </div>
        <div class="form-group">
            <label for="imgsuo">缩略图</label>
            <input type="file" class="form-control" id="imgsuo" name="imgsuo" value="{$res.imgsuo|default=''}">

            <notempty name="$res['imgsuo']">
                <img src="<?php echo cmf_get_image_url($res['imgsuo'])?>" />
            </notempty>

        </div>

        

        <div class="form-group">
            <label for="desc">维修公司简介</label>
            <textarea id="desc" name="desc"  class="form-control" rows="3">{$res.desc|default=''}</textarea>
        </div>

        <div class="form-group">
            <label for="desc">最近活动</label>
            <textarea id="active" name="active"  class="form-control" rows="3">{$res.active|default=''}</textarea>
        </div>

        <div class="form-group">
            <label>维修公司详情</label>
            <script id="content" name="content" type="text/plain"><?php echo htmlspecialchars_decode($res['content'])?></script>
        </div>
        
        <input type="hidden" name="type" value="wei">
        <button type="submit" class="btn btn-default js-ajax-submit">保存信息</button>
    </form>

</div>
<!-- 配置文件 -->
<script type="text/javascript" src="__TMPL__/public/assets/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="__TMPL__/public/assets/ueditor/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('content');
</script>
</body>
</html>